package com.wangsd.web.face.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 订单
 */
@Data
@Entity
@Table(name = "t_order")
@ApiModel(value = "订单", description = "订单信息")
public class TOrder implements Serializable {

    @Id
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "检索标识")
    private String code;

    @ApiModelProperty(value = "交易订单号")
    private String transactionId;

    @ApiModelProperty(value = "商户订单号")
    private String outTradeNo;

    @ApiModelProperty(value = "订单状态，0：未支付，1：已支付，2：支付失败，3：已退款，4：已撤销，5：押金支付")
    @Column(name = "order_status",columnDefinition = "int(10) default 0 not null")
    private Integer orderStatus;

    @ApiModelProperty(value = "服务商id")
    private Long businessServiceId;

    @ApiModelProperty(value = "代理商id")
    private Long agentId;

    @ApiModelProperty(value = "商户id")
    private Long merchantId;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @ApiModelProperty(value = "门店id")
    private Long storeId;

    @ApiModelProperty(value = "门店名称")
    private String storeName;

    @ApiModelProperty(value = "会员手机号码")
    private String phone;

    @ApiModelProperty(value = "门店店员id")
    private Long storeUserId;

    @ApiModelProperty(value = "订单创建人")
    private String orderCreateUserName;

    @ApiModelProperty(value = "退款人id")
    private Long refundUserId;

    @ApiModelProperty(value = "退款人名称")
    private String orderRefundUserName;

    @ApiModelProperty(value = "用户在子商户appid下的唯一标识")
    private String openid;

    @ApiModelProperty(value = "订单总金额")
    @Column(name = "order_total_fee",columnDefinition = "int(20) default 0 not null")
    private Long orderTotalFee;

    @ApiModelProperty(value = "商户实收金额")
    @Column(name = "member_total_fee",columnDefinition = "int(20) default 0 not null")
    private Long memberTotalFee;

    @ApiModelProperty(value = "押金金额")
    @Column(name = "deposit_fee",columnDefinition = "int(20) default 0 not null")
    private Long depositFee;

    @ApiModelProperty(value = "实际支付金额")
    @Column(name = "real_pay_fee",columnDefinition = "int(20) default 0 not null")
    private Long realPayFee;

    @ApiModelProperty(value = "商户实收金额")
    @Column(name = "settlement_total_fee",columnDefinition = "int(20) default 0 not null")
    private Long settlementTotalFee;

    @ApiModelProperty(value = "优惠券金额")
    @Column(name = "coupon_fee",columnDefinition = "int(20) default 0 not null")
    private Long couponFee;

    @ApiModelProperty(value = "支付方式：1：微信，2：支付宝,3：会员支付，4：通用通")
    @Column(name = "pay_type",columnDefinition = "int(10) default 0 not null")
    private Integer payType;

    @ApiModelProperty(value = "交易类型：FACEPAY：人脸，SCAN：主扫, SWEPT:被扫，DEPOSIT：押金，DEFAULT:默认类型")
    private String tradeType;

    @ApiModelProperty(value = "是否分账：Y：要分账，其余：不分账")
    @Column(name = "profit_sharing",columnDefinition = "varchar(8) default 'N' not null")
    private String profitSharing;

    @ApiModelProperty(value = "分账状态：0：初始化，1：分账中，2，分账完成，3，分账失败")
    @Column(name = "profit_sharing_status",columnDefinition = "int(1) default 0 not null")
    private Integer profitSharingStatus;

    @ApiModelProperty(value = "微信完成支付时间")
    private String timeEnd;

    @ApiModelProperty(value = "分账单号")
    private String orderId;

    @ApiModelProperty(value = "商户分账单号")
    private String outOrderNo;

    @ApiModelProperty(value = "设备编号")
    private String deviceNo;

    @ApiModelProperty(value = "小程序openid")
    private String miniOpenId;

    @ApiModelProperty(value = "开始时间")
    @Transient
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    @ApiModelProperty(value = "结束时间")
    @Transient
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

}
